﻿var vm = new Vue({
    el: '#app'
    , data: {
        input: {
            user_no: '',
            user_pwd: ''
        }
        , tipMessage: ''
        , messageStatus: ''
    }
    , mounted: function () {
        if (window.parent && window.parent.length) {
            window.parent.location = window.location;
            return;
        }
    }
    , methods: {
        onLogin: function () {
            let me = this;
            me.tipMessage = '';
            me.messageStatus = '';
            if (!me.input.user_no) {
                hcCore.showError('用户名不能为空');
                return;
            }
            if (!me.input.user_pwd) {
                hcCore.showError('密码不能为空');
                return;
            }

            let tType = hcCore.getTerminal();

            hcCore.post({
                url: '/Login/Valid'
                , param: {
                    user_no: me.input.user_no
                    , user_pwd: md5(me.input.user_pwd)
                    , terminal: tType.isIPad || tType.isIphone || tType.isAndroid || tType.isMobile || 1
                }
                , success: function (rsp) {
                    window.location = hcCore.virtualDirectory + '/Home';
                }
            });
        }
    }
});